//
//  ViewController.m
//  IOS1
//
//  Created by blue on 15-11-6.
//  Copyright (c) 2015年 lcm. All rights reserved.
//

#import "ViewController.h"
#import <QuartzCore/QuartzCore.h>
@interface ViewController ()
{
    UILabel * l;
    
}

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    
    self.view.backgroundColor = [UIColor magentaColor];
    l = [UILabel new];
    l.text =@"你好，世界！";
    [l sizeToFit];
    l.center = CGPointMake (self.view.frame.size.width/2.0,self.view.frame.size.height/2.0);
    l.textColor = [UIColor darkGrayColor];
    [self.view addSubview:l];
    
    
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn.frame = CGRectMake(100, 100, 200, 44);
    [btn setTitle:@"按钮" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(onClick:) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:btn];
    
    UIView * line =[[UIView alloc]initWithFrame:CGRectMake(0, 200, 0, 6)];
        line.backgroundColor = [UIColor brownColor];
      line.clipsToBounds=YES;
        [self.view addSubview:line];
   
  
      UIView * line2 = [[UIView alloc]initWithFrame:CGRectMake(self.view.frame.size.width/2.0, 0, 6, 0)];
     line2.backgroundColor = [UIColor purpleColor];
       [self.view addSubview:line2];
   
       UIView * line3 = [[UIView alloc]initWithFrame:CGRectMake(self.view.frame.size.width/2.0, 0, 6, 0)];
      line3.backgroundColor = [UIColor blackColor];
      [self.view addSubview:line3];
   
    
   
      [UIView animateWithDuration:1.6 animations:^{
           line .frame = CGRectMake(0, 200, self.view.frame.size.width, 6);
  
  
       }completion:^(BOOL finish){
          [UIView animateWithDuration:0.6 animations:^{
              line.frame = CGRectMake(self.view.frame.size.width, 200, 0, 6);
                line2.frame = CGRectMake(self.view.frame.size.width/2.0, 0, 3, self.view.frame.size.height);
                //line3.frame = CGRectMake(self.view.frame.size.width/2.0, 0, 3, self.view.frame.size.height);
   
         }completion:^(BOOL finish){
               [UIView animateWithDuration:0.6 animations:^{
                  line2.frame = CGRectMake(self.view.frame.size.width/2.0, self.view.frame.size.height, 6, 0);
   
             }completion:^(BOOL finish){
                   [UIView animateWithDuration:0.6 animations:^{
                       line3.frame = CGRectMake(self.view.frame.size.width/2.0, self.view.frame.size.height, 4, 0);
   
   
               }];
 
               
                 
             }];
         
         }];
        
       }];
    
}
    
   -(void )viewDidAppear:(BOOL)animated{
           [super viewDidAppear:animated];
        [UIView animateWithDuration:1.6 animations:^{
            l.center = CGPointMake(self.view.frame.size.width/2.0, self.view.frame.size.height - 400 );
        }];
         
      

    
}




- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
